<%-- 
    Document   : ajaxProduct
    Created on : Oct 30, 2013, 11:47:24 PM
    Author     : Mr.T
--%>

<%@page import="java.util.Enumeration"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="mysql.DataProvider"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
/*
    Enumeration<String> paramNames = request.getParameterNames();

    while(paramNames.hasMoreElements()) {
       String paramName = (String)paramNames.nextElement();
       System.out.print(paramName + " : ");
       String paramValue = request.getParameter(paramName);
       System.out.println(paramValue);
    }*/
    int curentPage=Integer.parseInt(request.getParameter("page"));
    String type=request.getParameter("type");
    String category=request.getParameter("category");
    ResultSet rset;
    if(type!=null && type.compareToIgnoreCase("3")==0){
        rset = DataProvider.loadTodayProduct(curentPage);
    }else{
        if(type!=null && type.compareToIgnoreCase("2")==0){
            rset = DataProvider.loadNewProduct(curentPage);
        }else{
            if(category!=null){
                rset = DataProvider.loadProductByCategory(category, curentPage);
            }else{
                rset = DataProvider.loadFeatureProduct(curentPage);
            }
        }
    }
    int i = 0;
    while (rset.next()) {
        if (i == 0) {
            out.write("<div class='row-fluid row-product'>");
        }
%>
<div class="list-rands-over span3">
    <div class="list-rands">
        <div class="box-frame-center">
            <div lang="41657" class="v6ItemHotImg v7Relative">

                <a href="#">
                    <div class="v7price_promotion fixPNG"><%= DataProvider.getDiscout(rset.getString("GiaGoc"), rset.getString("GiaBan"))%><span>%</span></div>
                    <img width="290" height="290" alt="Son Naris White" src="<%= rset.getString("HinhChinh")%>">
                </a>
                <div class="v7InfoType">
                    <div class="c"></div>
                </div>
            </div> 
            <div class="v6ContentHot">
                <div align="left" class="titledeals2">
                    <a href="#" title="Xem chi tiết deal"><%= rset.getString("TenSP")%></a> 
                </div>
            </div>
            <div class="v6TopBorder fixPNG">
                <div class="fl v7prices mTop3">
                    <div class="v7PromotionBigSold"><%= rset.getString("GiaBan")%><span>đ</span></div>
                    <div class="v7bnew mTop10">Đã mua: <b><%= rset.getString("LuotMua") %></b></div>
                </div>
                <a href="#" class="v7view fr fixPNG mTop20"><img width="61" height="30" src="../template/img/blank.gif"></a>
                <div class="c"></div>
            </div>
        </div>
    </div>
</div>

<%
        i++;
        if (i > 3) {
            out.write("</div><!--/fluid-row row-product-->");
            i = 0;
        }
    }
    // dong div cuoi cung
    if (i > 0 && i < 4) {
        out.write("</div><!--/fluid-row row-product-->");
    }
%>